const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('comHolderCount', {
    id: {
      autoIncrement: true,
      type: DataTypes.INTEGER,
      allowNull: false,
      primaryKey: true,
      comment: "编号"
    },
    create_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "创建时间"
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: false,
      defaultValue: Sequelize.Sequelize.literal('CURRENT_TIMESTAMP'),
      comment: "更新时间"
    },
    stock_name: {
      type: DataTypes.STRING(10),
      allowNull: true
    },
    stock_code: {
      type: DataTypes.STRING(10),
      allowNull: true,
      comment: "代码"
    },
    holder_total_num: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "股东人数"
    },
    holder_total_num_ratio: {
      type: DataTypes.DECIMAL(10,2),
      allowNull: true,
      comment: "股东变化率"
    },
    ave_free_shares_num: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "人均流通股数"
    },
    ave_free_shares_ratio: {
      type: DataTypes.DECIMAL(10,2),
      allowNull: true,
      comment: "人均流通股变化率"
    },
    hold_focus: {
      type: DataTypes.STRING(100),
      allowNull: true,
      comment: "筹码集中度"
    },
    price: {
      type: DataTypes.DECIMAL(20,2),
      allowNull: true,
      comment: "股价(元)"
    },
    ave_hold_amt: {
      type: DataTypes.DECIMAL(20,2),
      allowNull: true,
      comment: "人均持股金额(元)"
    },
    hold_ratio_total: {
      type: DataTypes.DECIMAL(5,2),
      allowNull: true,
      comment: "十大股东持股合计(%)"
    },
    freehold_ratio_total: {
      type: DataTypes.DECIMAL(5,2),
      allowNull: true,
      comment: "十大流通股东持股合计(%) "
    },
    end_date: {
      type: DataTypes.STRING(128),
      allowNull: true,
      comment: "统计时间"
    }
  }, {
    sequelize,
    tableName: 'com_holder_count',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
